package com.vn.rainbow.exoalarm.fragment;

import com.vn.rainbow.exoalarm.ui.CircularRevealView;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.util.DisplayMetrics;
import android.view.View;

public class BaseFragment extends Fragment {

	protected Activity mActivity;
	protected Context mContext;
	protected View rootView;
	protected CircularRevealView mRevealView;

	protected int screenWidth, screenHeight;

	protected int colorRipple;
	protected int timeRipple;

	protected Handler handler;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		mActivity = getActivity();
		mContext = mActivity.getApplicationContext();

		screenWidth = mContext.getResources().getDisplayMetrics().widthPixels;
		screenHeight = mContext.getResources().getDisplayMetrics().heightPixels;

		colorRipple = Color.WHITE;
		timeRipple = 500;

		handler = new Handler();
	}

	public void show() {

		handler.postDelayed(new Runnable() {
			@Override
			public void run() {
				mRevealView.reveal(screenWidth / 2, 0, colorRipple, 2, 500,
						null);
			}
		}, 100);

	}

	public void hide() {

		mRevealView.hide(screenWidth / 2, screenHeight / 2, colorRipple, 0,
				300, null);

	}
}
